package com.wonderful.wedding.service;

import com.wonderful.wedding.repository.GroupRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class GroupService {

    @Autowired
    private GroupRepository groupRepository;

    public int create(String groupName) {
        if (groupRepository.findGroupByName(groupName).isPresent()) {
            return 0;
        }

        return groupRepository.create(groupName);
    }
}
